require(['../../common'], function() {
  require(['article.contentlist'])
})

define('article.contentlist', [
    'jquery',
    'page/grid'
  ], function($) {
    'use strict';

  var $tree = $('#J_tree')
  var $frame = $('#content-frame')

  function zTreeBeforeClick(treeId, treeNode) {
    var src = APP + '?app=cms&m=Article&a=content&sid=' + treeNode.siteid +
      '&cid=' + treeNode.id + '&name=' + encodeURIComponent(treeNode.name)
    // console.log(src)
    $frame.attr('src', src)
  }

  function resizeHandler() {

  }

  $.getJSON(APP + '?app=cms&m=Article&a=cateTreeAllList')
  .done(function(data) {
    console.log(data)
    $.fn.zTree.init($tree, {
        data: {
          simpleData: {
            enable : true
          }
        },
        callback: {
          beforeClick: zTreeBeforeClick
        },
        view: {
          selectedMulti: false,
          showIcon: false,
          showLine: false
        }
    }, data)

    // $(window).on('resize', resizeHandler)
  })






  })
